import ctypes
from ctypes import *  
import time
objdll = ctypes.windll.LoadLibrary('./msdk.dll')
hdl = objdll.M_Open(1)
objdll.M_ReleaseAllMouse(hdl)
objdll.M_ResolutionUsed(hdl,1024,768)
def pressandreleasekeybyvalue(value,cs=1):
    objdll.M_KeyPress2(hdl,value,cs)


def presskeybyvalue(value):
    objdll.M_KeyDown2(hdl,value)


def releasekeybyvalue(value):
    objdll.M_KeyUp2(hdl,value)

def getMousePos():
    VintX = c_int()   #定义一个int型变量
    pIntX = pointer(VintX) #取得该变量指针
    VintY = c_int()   #定义一个int型变量
    pIntY = pointer(VintY) #取得该变量指针
    res = objdll.M_GetCurrMousePos2(pIntX, pIntY) #取得的值存放在VintX.value VintY.value中
    print("M_GetCurrMousePos2  X= " + str(VintX.value) + " Y= " + str(VintY.value)) #注意，这里是VintX.value VintY.value


def movemouseto(x,y):
    objdll.M_MoveTo3(hdl,x,y)

def pressandreleasemousebutton(cs=1):
    objdll.M_LeftClick(hdl,cs)
